public class test {
    public static void main(String[] args) {
	int biggest = 0;
	for (int a = 100; a < 1000; a++) {
	    for (int b = 100; b < 1000; b++) {
		String tmp = Integer.toString(a * b);
		if (tmp.length() == 6) {
		    if ((tmp.charAt(0) == tmp.charAt(5))
			    & (tmp.charAt(1) == tmp.charAt(4))
			    & (tmp.charAt(2) == tmp.charAt(3))) {
			if (biggest < a * b) {
			    biggest = a * b;
			}
		    }
		}
	    }
	}
	System.out.println(biggest);
    }
}